package org.dding.core.management;

import java.beans.ConstructorProperties;
import java.util.List;

/**
 * Management information about a module instance.
 *
 */
public final class ModuleInfo {
    private final String name;
    private final List<DependencyInfo> dependencies;
    private final List<ResourceLoaderInfo> resourceLoaders;
    private final String mainClass;
    private final String classLoader;
    private final String fallbackLoader;

    /**
     * Construct a new instance.
     *
     * @param name the module name
     * @param moduleLoader the module loader
     * @param dependencies the dependencies list
     * @param resourceLoaders the resource loaders list
     * @param mainClass the main class name
     * @param classLoader the class loader
     * @param fallbackLoader the fallback loader
     */
    @ConstructorProperties({"name","dependencies", "resourceLoaders", "mainClass", "classLoader", "fallbackLoader"})
    public ModuleInfo(final String name, final List<DependencyInfo> dependencies, final List<ResourceLoaderInfo> resourceLoaders, final String mainClass, final String classLoader, final String fallbackLoader) {
        this.name = name;
        this.dependencies = dependencies;
        this.resourceLoaders = resourceLoaders;
        this.mainClass = mainClass;
        this.classLoader = classLoader;
        this.fallbackLoader = fallbackLoader;
    }

    /**
     * Get the name of the corresponding module.
     *
     * @return the name of the corresponding module
     */
    public String getName() {
        return name;
    }

    /**
     * Get the dependency information list.
     *
     * @return the dependency information list
     */
    public List<DependencyInfo> getDependencies() {
        return dependencies;
    }

    /**
     * Get the resource loader information list.
     *
     * @return the resource loader information list
     */
    public List<ResourceLoaderInfo> getResourceLoaders() {
        return resourceLoaders;
    }

    /**
     * Get the main class name.
     *
     * @return the main class name
     */
    public String getMainClass() {
        return mainClass;
    }

    /**
     * Get the class loader (as a string).
     *
     * @return the class loader (as a string)
     */
    public String getClassLoader() {
        return classLoader;
    }

    /**
     * Get the fallback loader (as a string).
     *
     * @return the fallback loader (as a string)
     */
    public String getFallbackLoader() {
        return fallbackLoader;
    }
}
